<template>
  <div>
<head>
	<meta http-equiv="Content-Type" content="text/html;charset=UTF-8">
    
	<title>好又多生鲜-商品搜索结果列表</title>
	<link rel="stylesheet" type="text/css" href="css/reset.css">
	<link rel="stylesheet" type="text/css" href="css/main.css">

</head>
<body>

	<div class="header_con">
		<div class="header">
			<div class="welcome fl">欢迎来到好又多生鲜!</div>
			<div class="fr">
                
				<div class="login_btn fl">
					<a href="/user/login">登录</a>
					<span>|</span>
					<a href="/user/register">注册</a>
				</div>
                
				<div class="user_link fl">
					<span>|</span>
					<a href="/user/">用户中心</a>
					<span>|</span>
					<a href="/cart/">我的购物车</a>
					<span>|</span>
					<a href="/user/order/1">我的订单</a>
				</div>
			</div>
		</div>		
	</div>

	<div class="search_bar clearfix">
		<a href="/" class="logo fl"><img src="images/logo.png"></a>
		<div class="search_con fl">
            <form method="get" action="/search">
                <input type="text" class="input_text fl" name="q" placeholder="搜索商品">
                <input type="submit" class="input_btn fr" name="" value="搜索" @click="search">
            </form>
		</div>
		<div class="guest_cart fr">
			<a href="/cart/" class="cart_name fl">我的购物车</a>
			<div class="goods_count fl" id="show_count"></div>
		</div>
	</div>
    
	<div class="navbar_con">
		<div class="navbar clearfix">
			<div class="subnav_con fl">
				<h1>全部商品分类</h1>
				<span></span>
				<ul class="subnav">
                    
				</ul>
			</div>
			<ul class="navlist fl">
				<li><a href="">首页</a></li>
				<li class="interval">|</li>
				<li><a href="">手机生鲜</a></li>
				<li class="interval">|</li>
				<li><a href="">抽奖</a></li>
			</ul>
		</div>
	</div>
    
	<div class="breadcrumb">
		<a href="#">草莓</a>
		<span>></span>
		<a href="#">搜索结果如下:</a>
	</div>

	<div class="main_wrap clearfix">
        <ul class="goods_type_list clearfix">
            
            <li v-for="item in data_list" :key="item.id">
                <a href="'/detail?id='+item.id"><img :src="'http://127.0.0.1:8000/'+item.pic"></a>
                <h4>{{item.cate3}}</h4>
                <div class="operate">
                    <span class="prize">￥{{item.price}}</span>
                    <span class="unit">{{item.unit}}</span>
                    <a href="#" class="add_goods" title="加入购物车"></a>
                </div>
            </li>            
        </ul>
	</div>
</body>
  </div>
</template>
<script>

export default {
  data() {
    return {
      data_list:[],
    };
  },
  methods: {
    search() {
      this.axios.get("/search").then(resp=>{
          console.log(resp.data)
          this.data_list=resp.data
      })
    }
  }
};
</script>
